# Contributor: Edd Salkield <edd@salkield.uk>
# Maintainer: Edd Salkield <edd@salkield.uk>
pkgname=libiio
pkgver=0.25
pkgrel=1
pkgdesc="Interface to the Linux Industrial Input/Output (IIO) Subsystem"
url="http://analogdevicesinc.github.io/libiio/"
arch="all"
license="LGPL-2.1-or-later"
makedepends="
	avahi-dev
	bash
	bison
	cmake
	flex
	libaio-dev
	libserialport-dev
	libusb-dev
	libxml2-dev
	py3-setuptools
	samurai
	"
subpackages="
	$pkgname-dev
	$pkgname-doc
	$pkgname-pyc
	py3-$pkgname:python
	$pkgname-tools
	"
source="https://github.com/analogdevicesinc/libiio/archive/v$pkgver/libiio-v$pkgver.tar.gz"
options="!check" # no actual tests

build() {
	cmake -B build -G Ninja -Wno-dev \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_SBINDIR=bin \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_BUILD_TYPE=None \
		-DPYTHON_BINDINGS=ON \
		-DUDEV_RULES_INSTALL_DIR=/usr/lib/udev/rules.d \
		-DWITH_MAN=ON \
		-DWITH_SERIAL_BACKEND=ON \
		-DWITH_TESTS=ON # these are test binaries but not actual tyests
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

tools() {
	amove usr/bin/*
}

python() {
	pkgdesc="$pkgdesc (python module)"

	amove usr/lib/python*
}

sha512sums="
e0f2f5545b4c78d1f0f56b037db6e363aab01aad69af3a095b3546af74dab6effe0b00f5c336ef799a739f76c5f16ab76a6b8e823508861edd2745a9d3fd2599  libiio-v0.25.tar.gz
"
